#version 120

uniform sampler2D Texture;
uniform sampler2DShadow ShadowMap;

varying vec3 LightDirection, LightDirectionReflected, CameraDirection, Normal;

void main()
{
	float Shadow = shadow2DProj(ShadowMap, gl_TexCoord[1]).r;

	float NdotLD = max(dot(normalize(LightDirection), Normal), 0.0) * Shadow;
	float Spec = pow(max(dot(normalize(LightDirectionReflected), normalize(CameraDirection)), 0.0), 32.0) * Shadow;
	
	gl_FragColor = vec4(texture2D(Texture, gl_TexCoord[0].st).rgb * (0.25 + NdotLD * 0.75 + Spec), 1.0);
}
